const { Sequelize } = require("sequelize")

const sequelize = new Sequelize("building", "root", "yinfuwei819..", {
  host: "127.0.0.1",
  dialect: "mysql",
  logging: false,
})

// 测试数据库连接并同步
sequelize
  .authenticate()
  .then(() => sequelize.sync({ alter: false }))
  .catch((err) => {
    console.error("数据库连接失败:", err)
  })

module.exports = sequelize
